From 1e98b38411bc0c022075c2cc3b1c3c59a3f4ffc2 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 22 Sep 2008 15:50:59 +0100 Subject: [PATCH] Add debug key 'e' for event channel information Signed-off-by: Jan Beulich --- xen/common/event_channel.c | 72 ++++++++++++++++++++++++++++++++++++++ xen/common/keyhandler.c | 4 +-- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 6686b2294b..006d5eca3a 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1079,6 +1080,77 @@ void evtchn_destroy(struct domain *d) spin_unlock(&d->evtchn_lock); } +static void domain_dump_evtchn_info(struct domain *d) +{ + unsigned int port; + + printk("Domain %d polling vCPUs: %08lx\n", d->domain_id, d->poll_mask[0]); + + if ( !spin_trylock(&d->evtchn_lock) ) + return; + + printk("Event channel information for domain %d:\n", + d->domain_id); + + for ( port = 1; port < MAX_EVTCHNS(d); ++port ) + { + const struct evtchn *chn; + + if ( !port_is_valid(d, port) ) + continue; + chn = evtchn_from_port(d, port); + if ( chn->state == ECS_FREE ) + continue; + + printk(" %4u[%d/%d]: s=%d n=%d", + port, + test_bit(port, &shared_info(d, evtchn_pending)), + test_bit(port, &shared_info(d, evtchn_mask)), + chn->state, chn->notify_vcpu_id); + switch ( chn->state ) + { + case ECS_UNBOUND: + printk(" d=%d", chn->u.unbound.remote_domid); + break; + case ECS_INTERDOMAIN: + printk(" d=%d p=%d", + chn->u.interdomain.remote_dom->domain_id, + chn->u.interdomain.remote_port); + break; + case ECS_PIRQ: + printk(" p=%d", chn->u.pirq); + break; + case ECS_VIRQ: + printk(" v=%d", chn->u.virq); + break; + } + printk(" x=%d\n", chn->consumer_is_xen); + } + + spin_unlock(&d->evtchn_lock); +} + +static void dump_evtchn_info(unsigned char key) +{ + struct domain *d; + + printk("'%c' pressed -> dumping event-channel info\n", key); + + rcu_read_lock(&domlist_read_lock); + + for_each_domain ( d ) + domain_dump_evtchn_info(d); + + rcu_read_unlock(&domlist_read_lock); +} + +static int __init dump_evtchn_info_key_init(void) +{ + register_keyhandler('e', dump_evtchn_info, "dump evtchn info"); + return 0; +} +__initcall(dump_evtchn_info_key_init); + /* * Local variables: * mode: C diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index d478db8ad3..e24a6d335f 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -204,11 +204,11 @@ static void dump_domains(unsigned char key) printk("VCPU information and callbacks for domain %u:\n", d->domain_id); for_each_vcpu ( d, v ) { - printk(" VCPU%d: CPU%d [has=%c] flags=%lx " + printk(" VCPU%d: CPU%d [has=%c] flags=%lx poll=%d " "upcall_pend = %02x, upcall_mask = %02x ", v->vcpu_id, v->processor, v->is_running ? 'T':'F', - v->pause_flags, + v->pause_flags, v->poll_evtchn, vcpu_info(v, evtchn_upcall_pending), vcpu_info(v, evtchn_upcall_mask)); cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask); -- 2.30.2